<template>
	<view>
		<view class="head">
			<u-icon @click="returnButton()" name="arrow-left" color="#fff" size="30"></u-icon>
			<u-text text="订单详情" color="#fff" size="22" align="center" margin="4vh 0px 0px 0px"></u-text>
			<view style="padding: 0 60rpx;margin-top: 5vh;box-sizing: border-box;">
				<u-text text="支付成功,请前往指定门店消费" size="16" color="#fff" bold></u-text>
			</view>
			<view
				style="display: flex;width: 100%;justify-content: space-between;margin-top: 30rpx;box-sizing: border-box;padding: 0 7vw;">
				<view style="display: flex; align-items: center;">
					<image src="@/static/images/ls/商家1@3x.png" style="width: 8vw;height: 8vw;margin-right: 20rpx;">
					</image>
					<view>
						<u-text :text="shopInfo.name" color="#fff" size="18"></u-text>
						<u-text :text="shopInfo.area" color="#fff" size="14" lineHeight="20"></u-text>
					</view>
				</view>
				<view style="display: flex;align-items: center;">
					<image src="@/static/images/ls/plane1@3x.png" style="width: 6vw;height: 6vw;">
				</view>
			</view>

		</view>
		<view class="head-2">
		</view>
		<view class="content">
			<view>
				<u-text text="订单详情" bold size="19"></u-text>
				<view style="border: 2px solid #e2e2e2;margin-top: 20rpx;"></view>

				<view v-for="(item,index) in service.service" :key="index"
					style="display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">{{item.name}}</text>
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">{{item.newPrice}}</text>
				</view>
				<view v-for="(item,index) in service.shopCar" :key="item.id"
					style="display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">{{item.name}}</text>
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">{{item.money}}</text>
				</view>

			</view>
			<view style="border: 1px solid #e2e2e2;margin-top: 20rpx;"></view>

			<view style="display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
				<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;margin-top: 20rpx;">优惠券</text>
				<text
					style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;color: red;">-￥{{service.couponMoney}}</text>
			</view>
			<view style="border: 2px solid #e2e2e2;margin-top: 20rpx;"></view>

			<view style="display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
				<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">支付金额</text>
				<text
					style="font-size: 36rpx;font-weight: bold;line-height: 70rpx;color:#46D274 ">￥{{service.allMoney}}</text>
			</view>
		</view>

		<view class="content">
			<view>
				<u-text text="订单信息" bold size="19"></u-text>
				<view style="border: 2px solid #e2e2e2;margin-top: 20rpx;"></view>

				<view style="display: flex;justify-content: space-between;align-items: center;margin-top: 20rpx;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">订单号:</text>
					<text style="font-size: 32rpx;line-height: 70rpx;color: #636363;">{{orderInfo.number}}</text>
				</view>

				<view style="display: flex;justify-content: space-between;align-items: center;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">下单时间:</text>
					<text style="font-size: 32rpx;line-height: 70rpx;color: #636363;">{{orderInfo.createTime}}</text>
				</view>

				<view style="display: flex;justify-content: space-between;align-items: center;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">预约时间:</text>
					<text style="font-size: 32rpx;line-height: 70rpx;color: #636363;">2023.03.13 17:40</text>
				</view>

				<view style="display: flex;justify-content: space-between;align-items: center;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">车辆:</text>
					<text style="font-size: 32rpx;line-height: 70rpx;color: #636363;">本车FWE4/豫A98FHJ</text>
				</view>

				<view style="display: flex;justify-content: space-between;align-items: center;">
					<text style="font-size: 32rpx;font-weight: bold;line-height: 70rpx;">备注:</text>
					<text style="font-size: 32rpx;line-height: 70rpx;color: #636363;"></text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				shop_id: 1,
				// 商户信息
				shopInfo: {
					name: '未获取',
					area: '未获取',
				},
				// 已选服务
				service: {
					service: [],
					shopCar: [],
					couponMoney: 0,
					allMoney: 0,
					order_id: 0
				},
				// 订单信息
				orderInfo: {}
			}
		},
		methods: {
			// 获取商家信息
			getNotice(shop_id) {
				let that = this;
				this.$http({
					url: '/api/shop/manage/' + shop_id,
					method: 'GET',
					success(res) {
						if (!res.data.data) {
							console.log(res)
							return;
						}
						// console.log(res.data.data)
						that.shopInfo = res.data.data;
					}
				});
			},
			// 获取订单信息
			getOrderInfo(order_id) {
				let that = this;
				this.$http({
					url: '/api/management/management/' + order_id,
					method: 'GET',
					success(res) {
						if (!res.data.data) {
							console.log(res)
							return;
						}
						that.orderInfo = res.data.data;
					}
				});
			},
			returnButton() { // 返回
				uni.redirectTo({
					url: '/pages/ls/carWash/carWash?shop_id=' + this.shop_id
				})
			}
		},
		onLoad(options) {
			if (!options.shop_id) console.log(options);
			this.shop_id = options.shop_id;
			this.getNotice(this.shop_id);
			this.service = JSON.parse(options.service);
			this.getOrderInfo(this.service.order_id);
		}
	}
</script>

<style lang="scss">
	.content {
		// height: 30vh;
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		padding: 45rpx 25rpx;
		background-color: white;
		width: 90vw;
		margin: 0 auto;
		margin-bottom: 2vh;
		transform: translateY(27vh);
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 6px 20px rgba(0, 0, 0, 0.1);
		border-radius: 16rpx;
	}

	.head-2 {
		position: absolute;
		background-color: #3183FB;
		width: 100%;
		height: 32vh;
		overflow: auto;
		z-index: 0;
	}

	.head {
		position: fixed;
		background-color: #3183FB;
		width: 100%;
		height: 27vh;
		overflow: auto;
		z-index: 3;

		.u-icon {
			position: fixed;
			top: 4vh;
		}
	}
</style>